from django.db import models
from users.models import User

class PhaseSummary(models.Model):
    """阶段总结模型"""
    
    REPORT_TYPE_CHOICES = [
        (0, '无'),
        (1, '月度'),
        (2, '季度'),
        (3, '年度'),
    ]
    
    REPORT_STYLE_CHOICES = [
        (0, '无'),
        (1, '决策'),
        (2, '创新'),
        (3, '科研'),
    ]
    
    title = models.CharField('报告标题', max_length=255)
    content = models.TextField('报告内容')
    workflow_name = models.IntegerField(
        '工作流名称',
        choices=[(1, '阶段总结'), (2, '产业报告')],
        default=1
    )
    report_type = models.IntegerField(
        '报告类型',
        choices=REPORT_TYPE_CHOICES,
        default=0
    )
    report_style = models.IntegerField(
        '报告风格',
        choices=REPORT_STYLE_CHOICES,
        default=0
    )
    industry = models.CharField(
        '关联产业',
        max_length=255,
        blank=True,
        null=True
    )
    user = models.ForeignKey(User, on_delete=models.CASCADE, verbose_name='创建用户')
    created_at = models.DateTimeField('创建时间', auto_now_add=True)
    updated_at = models.DateTimeField('更新时间', auto_now=True)
    
    class Meta:
        verbose_name = '报告'
        verbose_name_plural = verbose_name
        db_table = 'reports'
        ordering = ['-created_at']
        managed = False
    
    def __str__(self):
        return self.title
